# a = ()
# print(type(a))


# #另外一种创建元组的方式
# a = tuple()
# print(type(a))
#
# a = (1,2,3,4,5)
# print(a)

# #元组也是可以存放不同类型的数据的
# a = ('nihao',1,3,5,True)
# print(a)

#
# a = (1,3,5,6)
# tmp = list(a)
# tmp[2] = 10
# a = tuple(tmp) #列表转换成元组，更改元组中的数据，但是不建议使用这种方式，没有意义
# print(a)

# #通过下面的方式，判断一个元素是否在元组中
# a = (1,3,4,56)
# print(1 in a)
# print(1 not in a)
# print(5 in a)
# print(5 not in a)


# a = (1,3,5,6)
# print(a.index(3) #下标的位置
# #抛异常
# # print(a.index(7))


# #使用[]来访问
# a = (1,4,52,3)
# print(a[1])
# #超出最大索引会抛异常
# #print(a[100])


# #可以使用负索引
# a = (1,4,5,3)
# print(a[-1])


# #元组遍历
# a = (1,3,5,67)
# for i in range(len(a)):
#     print(a[i],end=" ")
# print()
# for e in a:
#     print(e)


# a = (1,3,5,6,7)
# i = 0
# while i < len(a):
#     print(a[i],end=" ")
#     i += 1


# a = (1,4,5,6,7)
# print(a[1:4])

# a = (1,2,4,5)
# print(a[0:3])
# print(a[0:])
# print(a[:-1])
# print(a[:])


# #拼接元组
# a = (1,2,3,4)
# b = (5,6,7,8)
# print(a+b)


# #集合
# a = set()
# print(type(a))
# #这个是一个字典
# b = {}
# print(type(b))

# #底层应该和stl中的set一样是红黑树
# a = {1,2,3,4,5}
# print(type(a))
# print(a)


#可以存放不同的数据类型
# a = {1,3,5,True,False,'nihao'}
# print(type(a))
# print(a)


# a = {1,2,3,4,5}
# a.add(6)
# print(a)

# a = {1,2,3,4,5}
# a.update([7,8,9])
# print(a)

# #删除，不存在就抛异常
# a = {1,4,5,6}
# a.remove(1)
# # a.remove(7) #抛异常
#
# print(a)

#discard 删除指定元素，不存在不会抛异常
# a = {1,3,4,5,6}
# a.discard(1)
# a.discard(9)
# print(a)


# a = {7,1,3,4,5}
# a.pop()
# a.pop()
# print(a)
# print(1 in a)
# print(7 in a)

# a = {1,4,2,6,3,8,5,5}
# print(a)

# a = {1,3,4,5,6}
# for e in a:
#     print(e)


#不能通过索引进行遍历
# a = {1,4,2,6,3,8,5,5}
# i = 0
# while i < len(a):
#     print(a[i])


# #union 方法可以把两个集合合并
# a = {1,3,4}
# b = {2,6,7}
# c = a.union(b)
# print(a)
# print(b)
# print(c)


# #update可以将集合拼接，和union方式相似
# a = {1,3,5}
# b = {4,3,6}
# a.update(b)
# print(a)
# print(b)


#字典
# a = dict()
# print(type(a))

#字典中的数据是kv结果
# a = {
#     'name' : '张三',
#     'id' : 1
# }
# print(a)
# a['class'] = 1
# print(a)


#update
# a = {
#     'name' : '张三',
#     'id' : 1
# }
# a.update({'sex':'男'})
# print(a)

#删除kv
# a.pop('id')
# print(a)

#popitem可以删除最后一个
# a.popitem()
# print(a)
#判断元素是否在字典中
# print('id' in a)
# print('class' in a)

# a['class'] = 1
# for key in a:
#     print(key,a[key])

# for key in a.keys():
#     print(key)
# for val in a.values():
#     print(val)

# b = {
#     'sex' : '男',
#     'book' : 'python'
# }
# a.update(b)
# print(a)

# #可hash
# print(hash(0))
# print(hash(4.25))
# #不可hash，会抛异常
# print(hash({1,1}))


